﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using AMatysiak.Methods;

namespace AMatysiakTest.Methods.TypeExtensions
{
    [TestClass]
    public class ToIntTest
    {
        [TestMethod]
        public void parseInt()
        {
            string s = "5";
            int i = s.ToInt();

            Assert.AreEqual(5, i);
        }

        [TestMethod]
        [ExpectedException(typeof(FormatException))]
        public void parseDouble()
        {
            string s = "5.20";
            int i = s.ToInt();
        }

        [TestMethod]
        public void parseEmpty()
        {
            string s = "";
            int i = s.ToInt();

            Assert.AreEqual(0, i);
        }
    }
}
